<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of MatriculaAcademica
 *
 * @author Virtualidad
 * @export Modules
 * @export-metadata RequiredRoles:ROLE_STUDENT
 */
class MatriculaAcademica extends Module {

    

    public function index() {
        $materias = $this->model->subjects->GetHabilitadas($this->currentUser->getName());

        $this->assign("materias", $materias);
        $this->assign("GetCursos", $this->route->action("getCursosByMateria", array("ajax" => "true",)));

        $this->display("index");
    }

    public function getCursosByMateria(){
        $codigoMateria = $this->request->post("codigoMateria");
        //echo "Codigo materia: $codigoMateria";
        if($codigoMateria !== null){
            $cursos = $this->model->courses->GetByMateria($codigoMateria, true);
            echo $cursos;
        }else{
            echo "[]";
        }
    }
}

?>
